import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

@WebServlet("/FM02")
public class FreeMarker02 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setAttribute("flag",true);
        req.setAttribute("date",new Date());

        req.setAttribute("num1",18);
        req.setAttribute("num2",100000);
        req.setAttribute("num3",5.612);

        req.setAttribute("str1",null);
        req.setAttribute("str2","");


        req.getRequestDispatcher("/template/f02.ftl").forward(req, resp);
    }
}
